﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Koopakiller.Numerics.Addins;

namespace Koopakiller.Numerics.StandardAddins
{
    /// <summary>
    /// Addiert zwei Werte.
    /// </summary>
    public sealed class Addition : IFunctionObject
    {
        #region IFunctionObject Members

        double IFunctionObject.Calculate(params double[] parameters)
        {
            if (parameters.Length != 2)
                throw new ArgumentException();
            return parameters[0] + parameters[1];
        }

        int IFunctionObject.ParameterCount
        {
            get
            {
                return 2;
            }
        }

        string IFunctionObject.FunctionName
        {
            get
            {
                return "addition";
            }
        }

        #endregion
    }
    /// <summary>
    /// Subtrahiert zwei Werte.
    /// </summary>
    public sealed class Subtraction : IFunctionObject
    {
        #region IFunctionObject Members

        double IFunctionObject.Calculate(params double[] parameters)
        {
            if (parameters.Length != 2)
                throw new ArgumentException();
            return parameters[0] - parameters[1];
        }

        int IFunctionObject.ParameterCount
        {
            get
            {
                return 2;
            }
        }

        string IFunctionObject.FunctionName
        {
            get
            {
                return "subtract";
            }
        }

        #endregion
    }
    /// <summary>
    /// Multipliziert zwei Werte.
    /// </summary>
    public sealed class Multiplication : IFunctionObject
    {
        #region IFunctionObject Members

        double IFunctionObject.Calculate(params double[] parameters)
        {
            if (parameters.Length != 2)
                throw new ArgumentException();
            return parameters[0] - parameters[1];
        }

        int IFunctionObject.ParameterCount
        {
            get
            {
                return 2;
            }
        }

        string IFunctionObject.FunctionName
        {
            get
            {
                return "multiply";
            }
        }

        #endregion
    }
    /// <summary>
    /// Dividiert zwei Werte.
    /// </summary>
    public sealed class Division : IFunctionObject
    {
        #region IFunctionObject Members

        double IFunctionObject.Calculate(params double[] parameters)
        {
            if (parameters.Length != 2)
                throw new ArgumentException();
            return parameters[0] - parameters[1];
        }

        int IFunctionObject.ParameterCount
        {
            get
            {
                return 2;
            }
        }

        string IFunctionObject.FunctionName
        {
            get
            {
                return "division";
            }
        }

        #endregion
    }
}
